<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8" %>
<%@ page import="java.util.*" %>
<%@ page import="com.sms.homework.*" %>

<%	//清除内存
	response.setHeader("Pragma","No-cache"); 
	response.setHeader("Cache-Control","no-cache"); 
	response.setDateHeader("Expires", 0); 
%> 


<%
	request.setCharacterEncoding("utf-8");
	String userno = (String)session.getAttribute("userno");
	
	String row = request.getParameter("id");
	int num = Integer.parseInt(row);
	//System.out.print(num);
	List<Map> jlist=Homework.stugetwork(num);	
	Map map1=jlist.get(0);
	//得到该作业的对象并赋值
	Homework work= new Homework();
	work.init(map1);
	
%>	

<body>
<div id="work" style="padding:20px">


<table width="100%" height="100%" cellpadding="0" cellspacing="0">
    <tr><td width="10%"><label for="name">作业名称:</label></td><td style="text-align:left;height:30px;"><%= work.getTitle() %></td></tr>
    <tr><td><label for="desc">作业内容:</label></td><td><textarea readonly style="border:0;width:100%;background-color:white" rows=5><%=work.getContent() %></textarea></td></tr>  
    <tr><td><label for="begintime" style="width:110px;">作业开始时间：</label></td><td style="text-align:left;height:30px;"><%= work.getStartTime() %></td></tr> 
    <tr><td><label for="deadline" style="width:110px;">作业截止时间：</label></td><td style="text-align:left;height:30px;" id="changetime"><%= work.getEndTime() %></td></tr> 
    <tr><td><label for="header">布置作业者：</label></td><td style="text-align:left;height:30px;" id="changeLeader"><%= work.getName() %></td></tr>
     
     <% 
     	List<Map> appendFile = null;
		//如果有附件
		if(work.getIsAppend().equals("1")) {
			appendFile = new ArrayList<Map>();
			appendFile = work.getAppendFile();
			for(int i=0; i<appendFile.size(); i++) {
			
     %>  
      		<tr class="addfiles"><td><label for="file">附件链接：</label></td>
      		<td style="text-align:left;height:30px;">
      <% 
      		
      				Map<String, String> map = (Map<String, String>)appendFile.get(i);
      				String type=(String)map.get("type");
					String fileName = (String)map.get("fileName");
					String saveName = (String)map.get("saveName");
      %>
      			<a href="DownServlet?fileName=<%= fileName %>&saveName=<%= saveName %>"><%=type+i+":"+fileName %></a>&nbsp;&nbsp;
      <%
      		}
      %>
      
      		</td></tr>
      <% }%> 

</table>

</div>